/**
 * 
 */
package main;

import java.io.DataInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import tools.DoubleVector;
import tools.Vector;
import uncertainty.BertSimasUncertSet;
import uncertainty.UncertaintySet;


public class MainFunctions {
	
	public static Vector<Double> readDemandCosts(DataInputStream data) throws IOException {
		int dim = data.readInt();
		Vector<Double> d = new DoubleVector(dim);
		for(int i = 0; i < dim; i++) d.set(i, data.readDouble());
		return d;
	}
	
	public static Vector<Double> readStorageCosts(DataInputStream data) throws IOException {
		int dim = data.readInt();
		Vector<Double> d = new DoubleVector(dim);
		for(int i = 0; i < dim; i++) d.set(i, data.readDouble());
		return d;	
	}
	
	public static Vector<Double> readShortageCosts(DataInputStream data) throws IOException {
		int dim = data.readInt();
		Vector<Double> d = new DoubleVector(dim);
		for(int i = 0; i < dim; i++) d.set(i, data.readDouble());
		return d;
	}
	
	public static Vector<Double> readBounds(DataInputStream data) throws IOException {
		int dim = data.readInt();
		Vector<Double> d = new DoubleVector(dim);
		for(int i = 0; i < dim; i++) d.set(i, data.readDouble());
		return d;
	}
	
	public static UncertaintySet readUncertainSet(DataInputStream data) throws IOException {
		UncertaintySet s;
		Vector<Double> md;
		Vector<Double> vd;
		int dim = data.readInt();
		md = new DoubleVector(dim);
		vd = new DoubleVector(dim);
		int gamma = data.readInt();
		
		for(int i = 0; i < dim; i++)md.set(i, data.readDouble());

		for(int i = 0; i < dim; i++)vd.set(i, data.readDouble());	
		
		s= new BertSimasUncertSet(dim, gamma, md, vd);
		
		return null;
	}
	
	public static void writeSol(FileOutputStream file, String name, double value){
		//TODO
	}

}
